#include<bits/stdc++.h>
using namespace std;
const int N = 1e5+5;
int n,a[N];
int b[N],tot;
int c[N];
int ans,sum;
int l,r;
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin >> n;
    for(int i = 1;i <= n;i++) cin >> a[i];
    sort(a+1,a+n+1);
    if(a[n] == 2){
        for(int i = 1;i <= n;i++){
            if(a[i] == 1) l++;
            else r++;
        }
        cout << max(l,r);
        return 0;
    }
    for(int i = 1;i <= n;i++){
        if(a[i] != b[tot]) b[++tot] = a[i];
        c[tot]++;
    }
    l = 1;
    for(int i = 2;i <= tot;i++){
        sum = c[i];
        for(;l < i;l++){
            int cmp = c[l];
            ans += min(c[l],sum);
            c[l] -= min(c[l],sum);
            if(c[l] > 0) break;
            sum -= cmp-c[l];
        }
    }
    cout << n-ans;
    return 0;
}
